import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

import javax.imageio.ImageIO;


public class DiscardMenu extends Menu{
	
	private Player player;
	private int discardsLeft;
	private BufferedImage image;
	private SOCApplet applet;
	private boolean  visible;
	
	
	public DiscardMenu(SOCApplet applet){
		this.applet = applet;
		try {
			image = ImageIO.read(new File("card_tray.gif"));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	public void open(Player player){
		visible = true;
		for(int i = 0; i < player.getBrick(); i ++){
			//	MenuButton brickButton = new MenuButton("Brick Button", )
		}
		for(int i = 0; i < player.getRCards(); i ++){
			for(int h = 0; h < player.getBrick(); h ++){
				
			}
		}
		discardsLeft = 4;
	}

	@Override
	public void activate(String buttonName) {
		while(discardsLeft > 0){
			visible = true;
			if(buttonName.equals("Brick Button")){
				player.addBrick(-1);
			} else if(buttonName.equals("Grain Button")){
				player.addGrain(-1);
			} else if(buttonName.equals("Lumber Button")){
				player.addLumber(-1);
			} else if(buttonName.equals("Ore Button")){
				player.addOre(-1);
			} else if(buttonName.equals("Wool Button")){
				player.addWool(-1);
			}
			discardsLeft--;
		}
		visible = false;
	}

	@Override
	public void drawSelf(Graphics g) {
		// TODO Auto-generated method stub
		if(visible){
			g.drawImage(image, 100, 100, null);
		}
	}
	
}
